package edu.berkeley.cs160.innovationers.shoppersidekick.sync;

import android.graphics.drawable.BitmapDrawable;

/**
 * This creates a user session so that the ShopperSidekick application can interact with the server. Used by synchronization api's to
 * validate a user. There can only be one session at a time. Must call logout() before a new session can be started via login().
 * 
 * @author Nadir Muzaffar
 *
 */
public class UserSession {
	
	/**
	 * Should be called when trying to start a new user session.
	 * @param username
	 * @param password
	 * @throws UserLoginException
	 */
	public void login(String username, String password) throws UserLoginException {
		if( null != UserSession.currentSession )
			throw new UserLoginException(0);
		
	}
	
	/**
	 * Called to end/kill an active session.
	 * @return true if current session ended, false otherwise.
	 */
	public boolean logout() {
		UserSession.currentSession = null;
		return false;
	}
	
	/**
	 * 
	 * @return the actuall name of the user.
	 */
	public String getRealUsername() {
		return null;
	}
	
	/**
	 * 
	 * @return the actuall names of the friends of the current user.
	 */
	public String [] getFriendsRealUsernames() {
		return null;
	}
	
	/**
	 * 
	 * @return the user photo.
	 */
	public BitmapDrawable getUserPhoto() {
		return null;
	}
	
	/**
	 * 
	 * @param friendUserName
	 * @return the photo of friend.
	 */
	public BitmapDrawable getFriendPhoto(String friendUserName) {
		return null;
	}
	
	/**
	 * Do not use this constructor. Only use the login()/logout()/etc methods.
	 * @param username
	 * @param password
	 */
	private UserSession(String username, String password) {
		UserSession.currentSession = this;
	}
	

	private static UserSession currentSession = null; // This is used to make sure we only ever have one active UserSession
	public static String GOOGLE_ACCOUNT_TYPE = "com.google"; //used to get google accounts from AccountManager
}
